package com.zbkj.service.service.order;

import com.baomidou.mybatisplus.extension.service.IService;
import com.zbkj.common.model.order.OrderDetail;
import com.zbkj.common.model.product.Product;
import com.zbkj.common.model.user.User;
import com.zbkj.common.request.order.ClientOrderSaveRequest;
import com.zbkj.common.request.order.OrderDetailSaveRequest;
import com.zbkj.common.response.order.OrderDetailResponse;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 订单明细表 服务类
 * </p>
 *
 * @author 
 * @since 2024-09-15
 */
public interface OrderDetailService extends IService<OrderDetail> {

    List<OrderDetail> getListByOrderIds(List<Long> orderIdList);

    Map<Long, List<OrderDetail>> getGroupOrderIdMap(List<Long> orderIdList);

    List<OrderDetailResponse> pojoToDetailResp(List<OrderDetail> detailList);

    List<OrderDetail> saveOrderParamCheckAndPojoBuild(List<OrderDetailSaveRequest> detailReqList, User user, List<Product> dbProductList, Date currentDate);

    List<OrderDetail> reportOrderParamCheckAndPojoBuild(List<OrderDetailSaveRequest> orderDetailList, List<Product> dbProductList);

    int getValidYearProductOrderCount(Long userId);

    BigDecimal calcTotalDetailFromDetail(List<OrderDetail> orderDetailList);

    OrderDetail orderDetailBuild(Product product, long productNum);
}
